﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using UnityEngine;

namespace DashFire
{
  public class AssetBundleUtils
  {
    public static string GenFileMD5(string filePath)//生成文件的MD5码
    {
      FileStream fs = new FileStream(filePath, FileMode.Open);
      int len = (int)fs.Length;
      byte[] data = new byte[len];
      fs.Read(data, 0, len);
      fs.Close();
      MD5 md5 = new MD5CryptoServiceProvider();
      byte[] result = md5.ComputeHash(data);
      string fileMD5 = string.Empty;
      foreach (byte b in result)
      {
        fileMD5 += Convert.ToString(b, 16);
      }
      return fileMD5;
    }
  }
}

